<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="java.util.List"%>
<%@ page import="java.text.SimpleDateFormat"%>
<%@include file="../header.jsp" %>
<div id="center">
		<div class="content">

<%
	List albums = (List) request.getAttribute("albums");
	if(albums!=null){
    int n = albums.size();
	for (int i = 0; i < n; ) {
		Album album = (Album) albums.get(i++);
        String name = album.getName();
        String cover = album.getCover();
        int num = album.getPicNum();
%>
<blockquote>
<div>
<table>
<tr>
<td>
<img src="<%=cover%>" onclick=""><br />
<h5><a href="/blog/PictureServlet?method=<%=name%>"><%=name%>(<%=num%>张)</a></h5>
</td>
<% 
if(i<n){
	   album = (Album) albums.get(i++);
	   name = album.getName();
	   cover = album.getCover();
	   num = album.getPicNum();	
%>
<td>
<img src="<%=cover%>" onclick=""><br />
<h5><a href="/blog/PictureServlet?method=<%=name%>"><%=name%>(<%=num%>张)</a></h5>
</td>
<%}
if(i<n){
	   album = (Album) albums.get(i++);
	   name = album.getName();
	   cover = album.getCover();
	   num = album.getPicNum();	
%>
<td>
<img src="<%=cover%>" onclick=""><br />
<h5><a href="/blog/PictureServlet?method=<%=name%>"><%=name%>(<%=num%>张)</a></h5>
</td>
<%}
if(i<n){
	   album = (Album) albums.get(i++);
	   name = album.getName();
	   cover = album.getCover();
	   num = album.getPicNum();	
%>
<td>
<img src="<%=cover%>" onclick=""><br />
<h5><a href="/blog/PictureServlet?method=<%=name%>"><%=name%>(<%=num%>张)</a></h5>
</td>
<%}%>
</tr>
</table>
<p class="posted"></p>
</div>
</blockquote>
<%
	}
	}else{
	   out.write("没有相册啊~~~~");
	}
%> 
	</div>
	</div>
<div id="right">
	<div class="sidebar">
		<ul>
			<li>cloris的博客，欢迎大家多踩踩~</li>
		</ul>
        <ul>
			<h3><a href="<%=basePath%>album.do?cate" >添加照片</a></h3>
		</ul>
		<h2>分类</h2>
		<ul>
			<li><a href="">全部</a>
			</li>
			<%
				List categorys = (List) request.getSession().getAttribute(
						"categorys");
				if (categorys != null) {
					for (int i = 0; i < categorys.size(); i++) {
						Category category = (Category) categorys.get(i);
			%>
			<li><a
				href="<%=request.getContextPath()%>/HomeServlet?cid=<%=category.getId()%>"><%=category.getName()%></a>
			</li>
			<%
				}
				}
			%>
		</ul>

		<h2>最近的评论</h2>

		<ul>
			<%
				List comments = (List) request.getSession()
						.getAttribute("comments");
				if (comments != null) {
					for (int i = 0; i < comments.size(); i++) {
						Comment c = (Comment) comments.get(i);
			%>
			<li><a
				href="<%=request.getContextPath()%>/HomeServlet?method=get&id=<%=c.getBlogId()%>"
				target="_blank"><%=c.getContent()%></a>
			</li>
			<%
				}
				}
			%>
		</ul>
	</div>
</div>
</div>
<%@include file="../footer.jsp" %>